﻿{% extends "gma/base.html" %}

<!-- CONTENT
  =====================================================================-->

{% block content %}

<div class="page__hd">
    <h1 class="page__title">
        <i class="fa fa-broadcast-tower weui_grid_icon_fa" style="font-size: 32px"> </i> 视频转为动态
    </h1>
</div>

<div class="page__bd">
    <div class="weui-cells__title">消息内容</div>
    <div class="weui-cells">
         <div class="weui-cell">
            <div class="weui-cell__bd"> <p>审核通过的短视频</p> </div>
            <div class="weui-cell__ft">{{ authorized_video_count }}个</div>
        </div>
    </div>
</div>

<div class="weui-btn-area">
    <a class="weui-btn weui-btn_block weui-btn_primary" href="javascript:videoToMoment()"> <i class="fa fa-bullhorn"></i> 短视频生成动态 </a>
</div>

<div class="page__ft">
    <a href="{% url 'gma:home' %}">
        <span class="bottom-logo">
           HiBao
       </span>
    </a>
</div>

{% endblock content %}

<!-- SCRIPT
  =====================================================================-->

{% block extra_js %}
<script>

function videoToMoment() {
    show_confirm_dialog('确认', "确定要将当前的短视频转为动态?", ()=> {
        let url = "{% url 'gma:api_video_to_moment' %}";
        let data = {
            'uid': {{ user.id }},
        };

        new my_ajax(url, data, '', '', (ret) => {
            let count = ret['count'];
            show_toast(`发布${count}个动态!`);
            setTimeout(() => {
                window.location.reload();
            }, 1000);
        });
    });
}

</script>
{% endblock extra_js %}